#!/bin/bash
time=`date '+%y%m%d%H%M'`
function backup()
{
if [ -e $2 ]
then
tar -czvf $2/$time.tar.gz $1
fi

if [ ! -e $2 ]
then
mkdir $2
tar -czvf $2/$time.tar.gz $1
fi
}
backup $1 $2
echo "备份已完成！"
